<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<style type="text/tailwindcss" th:fragment="pub">
    @layer utilities {
        .content-auto {
            content-visibility: auto;
        }

        .card-shadow {
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        }

        .hover-lift {
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .hover-lift:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
        }

        .status-pill {
            @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
        }

        /* 表格样式 */
        .cluster-table {
            border-collapse: collapse;
            border: 1px solid #e5e7eb;
        }

        .cluster-table th,
        .cluster-table td {
            border: 1px solid #e5e7eb;
            vertical-align: middle;
            text-align: center;
        }

        /* 状态颜色 */
        .status-normal {
            color: #10b981 !important;
            font-weight: 600;
        }

        .status-warning {
            color: #f59e0b !important;
            font-weight: 600;
        }

        .status-error {
            color: #ef4444 !important;
            font-weight: 600;
        }
    }

    /* 模态框样式 */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }

    .cluster-modal-container {
        background: white;
        border-radius: 16px;
        width: 95%;
        max-width: 1000px;
        max-height: 90vh;
        overflow: hidden;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        transform: scale(0.95);
        animation: modalShow 0.3s ease forwards;
        display: flex;
        flex-direction: column;
    }

    @keyframes modalShow {
        to {
            transform: scale(1);
        }
    }

    .modal-header {
        padding: 24px 24px 0 24px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 24px;
    }

    .modal-header h3 {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
        color: #1f2937;
    }

    .modal-close {
        background: none;
        border: none;
        font-size: 20px;
        color: #6b7280;
        cursor: pointer;
        padding: 8px;
        border-radius: 6px;
        transition: all 0.2s;
    }

    .modal-close:hover {
        background-color: #f3f4f6;
        color: #374151;
    }

    .modal-body {
        padding: 0 24px;
        overflow-y: auto;
        flex: 1;
    }

    .modal-footer {
        padding: 24px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        border-top: 1px solid #e5e7eb;
        margin-top: 24px;
    }

    .form-section {
        background: #f8fafc;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;
    }

    .form-section-title {
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
        margin: 0 0 16px 0;
        padding-bottom: 8px;
        border-bottom: 2px solid #e5e7eb;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-label {
        display: block;
        font-size: 14px;
        font-weight: 500;
        color: #374151;
        margin-bottom: 6px;
    }

    .form-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        font-size: 14px;
        transition: all 0.2s;
        box-sizing: border-box;
    }

    .form-input select,
    select.form-input {
        height: 42px;
        line-height: 1.5;
        appearance: none;
        background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 12px;
        padding-right: 32px;
    }

    .form-input:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    /* 主题类型图标选择器样式（参考topics.html） */
    .topic-icon-select {
        width: 100%;
    }

    .topic-icon-dropdown .select2-results__option {
        padding: 10px 12px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .topic-icon-dropdown .select2-results__option .icon-preview {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .topic-icon-dropdown .select2-results__option .icon-info {
        flex-grow: 1;
    }

    .topic-icon-dropdown .select2-results__option .icon-title {
        font-weight: 500;
        margin-bottom: 2px;
        padding: 4px;
    }

    .topic-icon-dropdown .select2-results__option .icon-description {
        font-size: 0.75rem;
        color: #6b7280;
    }

    .topic-icon-dropdown .select2-results__option[aria-selected="true"] {
        background-color: #f3f4f6;
        color: #111827; /* 确保选中项文字可读 */
    }

    .topic-icon-dropdown .select2-results__option--highlighted[aria-selected] {
        background-color: #f9fafb;
        color: #111827; /* 修复高亮状态下白底白字问题 */
    }

    /* 选中项的样式 */
    .topic-icon-select+.select2 .select2-selection--single {
        height: 42px;
        display: flex;
        align-items: center;
        padding: 0 8px;
    }

    .topic-icon-select+.select2 .select2-selection__rendered {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .topic-icon-select+.select2 .icon-preview {
        width: 24px;
        height: 24px;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 图标颜色定义 */
    .icon-color-blue {
        background-color: #EBF5FF;
        color: #2563EB;
    }

    .icon-color-green {
        background-color: #ECFDF5;
        color: #059669;
    }

    .icon-color-purple {
        background-color: #F5F3FF;
        color: #7C3AED;
    }

    .icon-color-orange {
        background-color: #FFF7ED;
        color: #EA580C;
    }

    .icon-color-gray {
        background-color: #F9FAFB;
        color: #4B5563;
    }

    .icon-color-red {
        background-color: #FEF2F2;
        color: #DC2626;
    }

    .icon-color-brown {
        background-color: #FDF6F3;
        color: #92400E;
    }

    .icon-color-teal {
        background-color: #F0FDFA;
        color: #0D9488;
    }

    .icon-color-yellow {
        background-color: #FFFBEB;
        color: #D97706;
    }

    /* 确保Select2下拉框显示在模态框之上 */
    .select2-dropdown {
        z-index: 1050 !important;
    }

    .select2-container--open .select2-dropdown {
        z-index: 1050 !important;
    }

    .modal-overlay .select2-dropdown {
        z-index: 10000 !important;
    }

    .btn-primary {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
    }

    .btn-primary:hover {
        background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    }

    .btn-secondary {
        background: #f9fafb;
        color: #374151;
        border: 1px solid #d1d5db;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
    }

    .btn-secondary:hover {
        background: #f3f4f6;
        border-color: #9ca3af;
    }

    .tab-container {
        margin-bottom: 24px;
    }

    .tab-buttons {
        display: flex;
        border-bottom: 2px solid #e5e7eb;
        margin-bottom: 20px;
    }

    .tab-btn {
        padding: 12px 24px;
        background: none;
        border: none;
        font-size: 14px;
        font-weight: 600;
        color: #6b7280;
        cursor: pointer;
        transition: all 0.3s ease;
        border-bottom: 2px solid transparent;
        margin-bottom: -2px;
    }

    .tab-btn.active {
        color: #165DFF;
        border-bottom-color: #165DFF;
    }

    .tab-btn:hover {
        color: #374151;
    }

    .tab-content {
        display: none;
    }

    .tab-content.active {
        display: block;
    }

    .form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
        border-bottom: 2px solid #e2e8f0;
        padding-bottom: 8px;
    }

    .section-header h4 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
    }

    .security-switch {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 16px;
    }

    .switch {
        position: relative;
        display: inline-block;
        width: 50px;
        height: 24px;
    }

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #ccc;
        transition: .4s;
        border-radius: 24px;
    }

    .slider:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: .4s;
        border-radius: 50%;
    }

    input:checked + .slider {
        background-color: #3b82f6;
    }

    input:checked + .slider:before {
        transform: translateX(26px);
    }

    .form-textarea {
        resize: vertical;
        min-height: 80px;
    }

    .submit-btn {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
        border: none;
        padding: 12px 24px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .submit-btn:hover {
        background: linear-gradient(135deg, #059669 0%, #047857 100%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    }

    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        backdrop-filter: blur(2px);
    }

    .delete-confirm-container {
        background: white;
        border-radius: 12px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        max-width: 420px;
        width: 90%;
        animation: modalSlideIn 0.3s ease-out;
    }

    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: scale(0.9) translateY(-20px);
        }

        to {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }

    .delete-confirm-header {
        padding: 24px 24px 16px 24px;
        text-align: center;
    }

    .delete-confirm-icon {
        width: 64px;
        height: 64px;
        background: #FEF2F2;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 16px;
    }

    .delete-confirm-icon i {
        font-size: 24px;
        color: #DC2626;
    }

    .delete-confirm-title {
        font-size: 20px;
        font-weight: 600;
        color: #111827;
        margin: 0;
    }

    .delete-confirm-body {
        padding: 0 24px 24px 24px;
        text-align: center;
    }

    .delete-confirm-message {
        font-size: 16px;
        color: #374151;
        margin: 0 0 12px 0;
        line-height: 1.5;
    }

    .delete-confirm-description {
        font-size: 14px;
        color: #6B7280;
        margin: 0;
        line-height: 1.4;
        background: #F9FAFB;
        padding: 12px;
        border-radius: 6px;
        border-left: 3px solid #FBD38D;
    }

    .delete-confirm-footer {
        padding: 0 24px 24px 24px;
        display: flex;
        gap: 12px;
        justify-content: center;
    }

    .btn-cancel {
        background: #F3F4F6;
        color: #374151;
        border: 1px solid #D1D5DB;
        padding: 10px 20px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .btn-cancel:hover {
        background: #E5E7EB;
        border-color: #9CA3AF;
    }

    .btn-danger {
        background: #DC2626;
        color: white;
        border: 1px solid #DC2626;
        padding: 10px 20px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .btn-danger:hover {
        background: #B91C1C;
        border-color: #B91C1C;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
    }

    .mr-2 {
        margin-right: 8px;
    }

    /* Toast 通知样式 */
    .toast-container {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1050;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .toast {
        background: white;
        border-radius: 8px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        padding: 16px;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        min-width: 300px;
        max-width: 400px;
        animation: toastSlideIn 0.3s ease-out;
        border-left: 4px solid #10B981;
    }

    .toast.error {
        border-left-color: #DC2626;
    }

    .toast.warning {
        border-left-color: #F59E0B;
    }

    .toast.info {
        border-left-color: #3B82F6;
    }

    .toast.slide-out {
        animation: toastSlideOut 0.3s ease-in;
    }

    @keyframes toastSlideIn {
        from {
            opacity: 0;
            transform: translateX(100%);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    @keyframes toastSlideOut {
        from {
            opacity: 1;
            transform: translateX(0);
        }

        to {
            opacity: 0;
            transform: translateX(100%);
        }
    }

    .toast-icon {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .toast-icon i {
        font-size: 16px;
    }

    .toast.success .toast-icon i {
        color: #10B981;
    }

    .toast.error .toast-icon i {
        color: #DC2626;
    }

    .toast.warning .toast-icon i {
        color: #F59E0B;
    }

    .toast.info .toast-icon i {
        color: #3B82F6;
    }

    .toast-content {
        flex: 1;
    }

    .toast-title {
        font-weight: 600;
        color: #111827;
        margin-bottom: 4px;
        font-size: 14px;
    }

    .toast-message {
        color: #6B7280;
        font-size: 13px;
        line-height: 1.4;
    }

    .toast-close {
        background: none;
        border: none;
        color: #9CA3AF;
        cursor: pointer;
        padding: 4px;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .toast-close:hover {
        background: #F3F4F6;
        color: #6B7280;
    }

    .toast-close i {
        font-size: 12px;
    }
</style>
</html>